{% extends "file.html" %}

{% block content %}
  {{ super() }}

  {% set state_eof = True %}

  {% block bubble %}
    {% if bubble %}
      <div class="bubble info">
        {% if bubble == 'single' %}
          There was only 1 search result, so I took you straight to it.
        {% else %}
          Showing a direct result.
          <a href="{{ url_for('.search', tree=tree, q=query) }}">
          Show all results instead.</a>
        {% endif %}
      </div>
    {% else %}
      {{ super() }}
    {% endif %}
  {% endblock %}

  <div id="annotations">
    {% for line, annotations in lines %}
      <div class="annotation-set" id="aset-{{ loop.index }}">
        {%- for annotation in annotations -%}
          <div {% for key, value in annotation.items() %}
                {{ key }}="{{ value }}"
               {% endfor %} ></div>
        {%- endfor -%}
      </div>
    {%- endfor -%}
  </div>

  <table id="file" class="file">
    <thead class="visually-hidden">
        <th scope="col">Line</th>
        <th scope="col">Code</th>
    </thead>
    <tbody>
      <tr>
        <td id="line-numbers">
          {% for line in lines %}
            <span id="{{ loop.index }}" class="line-number" unselectable="on" rel="#{{ loop.index }}">{{ loop.index }}</span>
          {% endfor %}
        </td>
        <td class="code">
          {% if is_binary %}
            (binary file)
          {% endif %}
<pre>
{% for line, annotations in lines -%}
<code id="line-{{ loop.index }}" aria-labelledby="{{ loop.index }}">{{ line }}</code>
{%- endfor -%}
</pre>
        </td>
      </tr>
    </tbody>
  </table>
{% endblock %}
